<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title> - 基本表单</title>
    <meta name="keywords" content="">
    <meta name="description" content="">
    <link rel="shortcut icon" href="../favicon.ico">
    <link href="/Public/css/bootstrap.min.css?v=3.3.6" rel="stylesheet">
    <link href="/Public/css/font-awesome.css?v=4.4.0" rel="stylesheet">
    <link href="/Public/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link href="/Public/css/animate.css" rel="stylesheet">
    <link href="/Public/css/style.css?v=4.1.0" rel="stylesheet">

</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>客服管理-
                        <small>新建客服账号</small>
                    </h5>
                </div>
                <div class="ibox-content">
                    <form method="post" class="form-horizontal" onsubmit="return false">
                        <div class="form-group">
                            <label class="col-sm-2 control-label">*IP</label>
                            <div class="col-sm-10">
                                <input class="form-control" type="text" id="ip" name="ip" placeholder="请输入IP">
                            </div>
                        </div>


                        <div class="hr-line-dashed"></div>
                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button class="btn btn-primary" type="button" onclick="add()">添加</button>

                            </div>
                        </div>
                    </form>

                </div>
            </div>
        </div>
    </div>
</div>

<script src="/Public/js/jquery.min.js?v=2.1.4"></script>
<script src="/Public/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/Public/js/content.js?v=1.0.0"></script>
<script src="/Public/js/plugins/layer/layer.min.js"></script>
<script>
    function add() {
        var index = layer.load(1, {
            shade: [0.1, '#fff'] //0.1透明度的白色背景
        });
        var url = "<{$SRVER_NAME}>/admin.php/CustomerService/add_ip";
        var ip = $("#ip").val();

        if (ip == "" ) {
            layer.close(index);
            layer.alert("请信息填写完整！\r\n", {
                title: '提示框',
                icon: 0,
            });
            return false;
        } else {
            console.log('sssss',12121);
            $.post(url, {ip: ip}, function (data) {
                console.log('sssss',data);
                if (data.code == "1001") {

                    layer.alert('添加成功', {title: '提示框', icon: 1}, function () {
                        window.location.reload();
                        layer.close(index);
                    });
                }
                else {

                    layer.alert(data.result, {title: '提示框', icon: 1});
                    layer.close(index);
                }
            });
        }
        layer.close(index);
    }


</script>
</body>
</html>
